package com.epfly.iface.promo.activity.enums;


import com.google.common.collect.Maps;

import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 下单方式:0.不限;1.绑盘;2.后支付;3.点餐;4.视觉识别;5.预定;
 */
public enum EffectiveOrderMethodsEnum {
    NO_LIMIT((byte) 0, "不限"), BIND((byte) 1, "绑盘"), PAY_LATER((byte) 2, "后支付"),
    ORDER((byte) 3, "点餐"), VISION((byte) 4, "视觉"), PRE((byte) 5, "预定");

    private final Byte key;

    private final String value;


    EffectiveOrderMethodsEnum(Byte key, String value) {
        this.key = key;
        this.value = value;
    }

    private static final Map<Byte, EffectiveOrderMethodsEnum> loopUp = Maps.newHashMap();

    static {
        for (EffectiveOrderMethodsEnum value : values()) {
            loopUp.put(value.getKey(), value);
        }
    }
    public static String getValue(Collection<Byte> keyList) {
        return keyList.stream().map(e -> loopUp.get(e).getValue()).collect(Collectors.joining("、"));
    }

    public Byte getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
